class CommodityIterator:
    def __init__(self,data):
        self.data=data
        self.index=-1
    def __next__(self):
        if self.index>=-1:
            raise StopIteration
        self.index+=1
        return self.data[self.index]


class CommodityController:
    def __init__(self):
        self.list_commodity = []
    def __iter__(self):
        return CommodityIterator(self.list_commodity)
    def add_commodity(self,cmd):
        self.list_commodity.append(cmd)

controller = CommodityController()
controller.add_commodity("屠龙刀")
controller.add_commodity("倚天剑")
controller.add_commodity("芭比娃娃")
for item in controller:
    print(item)
